﻿using System;
using System.Reflection;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using FluentNHibernate.Testing;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NHibernate;
using NHibernate.Dialect;
using NHibernate.Driver;
using NHibernate.Tool.hbm2ddl;
using YasharEl.Infrastructure.Core.PersistenceModel.NHibernate.Prototype.Mappings;
using YasharEl.Infrastructure.ProcessEngine.EntityModel;
using YasharEl.Infrastructure.ProcessEngine.PersistenceModel.NHibernate.Mappings;
using NCfg = NHibernate.Cfg;

namespace YasharEl.Infrastructure.ProcessEngine.PersistenceModel.NHibernate.Tests
{
    [TestClass]
    public class ProcessDefinitionMappingTest : InMemoryDatabaseTest
    {
        public ProcessDefinitionMappingTest()
            : base
            (
                new Assembly[] 
                { 
                    typeof(ProcessDefinitionEntityMap).Assembly, 
                    typeof(PropertyDefinitionEntityMap).Assembly 
                }
            )
        {

        }

        [TestMethod]
        public void CanCorrectlyMapProcessDefinition()
        {
            new PersistenceSpecification<ProcessDefinitionEntity>(session)
                .CheckProperty(c => c.ProcessDefinitionId, (long)1)
                .CheckProperty(c => c.Name, "InfrastructureTestProcess")
                .CheckProperty(c => c.Description, "Infrastructure test process")
                .CheckProperty(c => c.WorkflowXaml, @"Tests\InfrastructureTestProcess.xaml")
                .CheckProperty(c => c.SLA, (long)7)
                .VerifyTheMappings();
        }
    }
}
